import request from '@/utils/request'

// 获取试卷及题目详情（用于答题）
export function getPaperForExam(paperId, isExam = true) {
  return request({
    url: `/paper/exam/paper/${paperId}`,
    method: 'get',
    params: { isExam }
  })
}

// 保存答题进度
export function saveAnswerProgress(data) {
  return request({
    url: '/paper/exam/save',
    method: 'post',
    data: data
  })
}

// 提交考试答案
export function submitExamAnswer(data) {
  return request({
    url: '/paper/exam/submit',
    method: 'post',
    data: data
  })
}

// 获取考试答案
export function getExamAnswer(paperId) {
  return request({
    url: '/manage/exam/answer/' + paperId,
    method: 'get'
  })
}

// 获取学生答题记录
export function getStudentAnswers(paperId) {
  return request({
    url: '/manage/exam/student/answers/' + paperId,
    method: 'get'
  })
}

// 获取已保存的答题进度
export function getAnswerProgress(paperId) {
  return request({
    url: `/paper/exam/progress/${paperId}`,
    method: 'get'
  })
}

// 获取服务器当前时间
export function getServerTime() {
  return request({
    url: '/paper/exam/server-time',
    method: 'get'
  })
}

// 检查试卷是否已提交
export function getExamSubmitStatus(paperId) {
  return request({
    url: `/paper/exam/submit-status/${paperId}`,
    method: 'get'
  })
} 